
<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>发表评论</title>
		<meta id="viewport" name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1; user-scalable=no">
		<link rel="stylesheet" href="/static/home/css/ydui.css" />
		<link rel="stylesheet" href="/static/home/css/product.css" />
	</head>
	<body>
		<div class="writecomment-box">
			<div>
				<textarea maxlength='100' placeholder="请输入你的评价内容" style="height:120px;border-style: none;"></textarea>
				<span class="text-lengthxt">0/100</span>
			</div>
		</div>
		<input type="hidden" name="ids" value="{$id}">
		<button class="send-comment">发表评论</button>
		<script src="/static/home/js/jquery-1.12.4.min.js"></script>
		<script src="/static/home/js/ydui.js"></script>
		<script type="text/javascript">
			$("textarea").bind('input propertychange keyup',function(){
				$(".text-lengthxt").text($("textarea").val().length+"/100");
			})
			$(".send-comment").click(function(){
				var id = $('input[name=ids]').val();
				YDUI.dialog.loading.open('发表中...');
				$.post("{:url('bank/savemsg')}",{content:$("textarea").val(),pid:id},function(data){
					if(data.code == 0){
						setTimeout(function() {
							YDUI.dialog.loading.close();
							YDUI.dialog.toast(data.msg, 'success', 800,function() {
								location.replace("/product/bank/"+id);
							});
						}, 1000);
					}else{
						setTimeout(function() {
							YDUI.dialog.loading.close();
							YDUI.dialog.toast(data.msg, 'error', 800,function() {});
						}, 1000);
					}
				});
			});
		</script>
	</body>
</html>